<include file="Common:header" title="新房源列表"/>
<link href="__PUBLIC__/assets/css/plugins/blueimp/css/blueimp-gallery.min.css" rel="stylesheet">
<link href="__PUBLIC__/assets/css/plugins/footable/footable.core.css" rel="stylesheet">
<style>
    .title{overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 1;-webkit-box-orient: vertical;}
</style>
<div id="wrapper">
    <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title"><h5>舞蹈列表</h5></div>
                    <div class="ibox-content">
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="col-xs-12 col-sm-5">
                                    <form name="admin_list_sea" class="form-search" method="post" action="{:U('Course/index')}">
                                        <div class="input-group">
                                            <input type="text" name="val" id="val" class="form-control search-query admin_sea" value="{$val}" placeholder="输入需查询的物品名" />
                                            <span class="input-group-btn">
											<button type="submit" class="btn btn-purple">
												<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
												搜索
											</button>
										</span>
                                        </div>
                                    </form>
                                </div>
                                <div class="input-group-btn">
                                    <a href="{:U('Course/index')}">
                                        <button type="button"  class="btn  btn-info">
                                            <span class="ace-icon fa fa-globe icon-on-right bigger-110"></span>
                                            显示全部
                                        </button>
                                    </a>
                                </div>
                            </div>
                        </div>
                        <div class="table-responsive"><br/>

                            <table width="100%" class="table table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th width="5%">ID</th>
                                    <th width="10%">舞蹈名称</th>
                                    <th width="5%">舞种</th>
                                    <th width="5%">难度</th>
                                    <th width="10%">url</th>
                                    <th width="8%">图片</th>
                                    <th width="10%">添加时间</th>
                                    <th width="8%">操作</th>

                                </tr>
                                </thead>

                                <tbody>
                                <foreach name="data" item="v">
                                    <tr href="{:U('Goods/goods_detailed')}">
                                        <td height="28" >{$v.id}</td>
                                        <td><div class="title" style="cursor:pointer" onclick="detailed(this)">{$v.name}</div></td>
                                        <td>{:get_dance_type_name($v['dance_type'])}</td>
                                        <td><div class="title" style="cursor:pointer" onclick="detailed(this)">{:get_difficulty_type_name($v['difficulty_type'])}</div></td>
                                        <td><div class="title" style="cursor:pointer" onclick="detailed(this)">{$v.url}</div></td>

                                        <?php $image = explode(',',$v['images']);

                                            ?>

                                        <td>
                                                <a href="{$image[0]}" title="点击查看大图" data-gallery=""><img style="width:280px;height: 70px;margin-right: 5px;" src='{$image[0]}' /></a>
                                        </td>
                                        <td>
                                            {$v.add_time|date='Y-m-d H:i:s',###}
                                        </td>
                                        <td>
                                            <a style="margin:0;" class="btn btn-xs btn-info"  href="{:U('Course/edit_Course',array('id'=>$v['id']))}">
                                                <i class="fa fa-pencil" style="font-size: 14px;"></i>&nbsp;编辑</a>
                                            <a class="red" href="javascript:;" onclick="del({$v.id})"  title="删除">
                                                <span class="label label-danger">删除</span>
                                            </a>
                                        </td>

                                    </tr>
                                    </tr>
                                </foreach>
                                <tr>
                                    <td height="50" colspan="11" align="right">{$page}</td>
                                </tr>
                                </tbody>

                            </table>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="blueimp-gallery" class="blueimp-gallery">
    <div class="slides"></div>
    <h3 class="title"></h3>
    <a class="prev">‹</a>
    <a class="next">›</a>
    <a class="close">×</a>
    <a class="play-pause"></a>
    <ol class="indicator"></ol>
</div>
<include file="Common:footer"/>
<script src="__PUBLIC__/assets/js/plugins/blueimp/jquery.blueimp-gallery.min.js"></script>
<script src="__PUBLIC__/assets/js/plugins/footable/footable.all.min.js"></script>
<script>

    //    状态按钮
    function change(id,btn) {
        $.ajax({
            type:'Post',
            url:"{:U('Newbuilding/top_status')}",
            data: {id:id},
            beforeSend:function(XMLHttpRequest){
                var index = layer.load(2, {
                    shade: [0.1,'#fff'] //0.1透明度的白色背景
                });
            },  success:function(data,textStatus){
                layer.closeAll("loading");
                $(btn).text(data.info);
                if(data.info=='推荐'){
                    $(btn).removeClass('btn-danger');
                    $(btn).addClass('btn-primary');
                    layer.msg(data.info, {icon: 6});
                }else{
                    $(btn).removeClass('btn-primary');
                    $(btn).addClass('btn-danger');
                    layer.msg(data.info, {icon: 5});
                }

            }, complete:function(XMLHttpRequest,textStatus){
                if(textStatus=='success'){
                    layer.close(index)
                    layer.msg('不推荐', {icon: 5});
                }
            },
            error:function(){
                //请求出错处理
            }
        });
    }
    function del(id) {
        layer.confirm('你确定要删除？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            window.location.href="__URL__/del_course/id/"+id;
        });
    }
    function detailed(obj) {
        if(obj.getAttribute('class')=='title'){
            var reg = new RegExp('(\\s|^)title(\\s|$)');
            obj.className = obj.className.replace(reg, ' ');
        }
        else{
            obj.className = "title";
        }
    }
</script>
